﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VehicleScale.Models;

namespace VehicleScale.EntityMappers
{
    public class VehicleScaleSplitMapper
    {
        #region Methods With Relation
        public static VehicleScaleSplitModel ToModel(VehicleScaleSplit entity)
        {
            if (entity == null) return null;

            VehicleScaleSplitModel model = new VehicleScaleSplitModel()
            {
                VehicleScaleSplitID = entity.VehicleScaleSplitID,
                VehicleScaleID = entity.VehicleScaleID,
                ProductID = entity.ProductID,
                Weight = entity.Weight,
                Description = entity.Description,
                Product = ProductMapper.ToModel(entity.Product, 0),
                VehicleScale = VehicleScaleMapper.ToModel(entity.VehicleScale, 0)
            };
            
            return model;
        }

        public static VehicleScaleSplit ToEntity(VehicleScaleSplit entity, VehicleScaleSplitModel model)
        {
            if (model == null) return null;

            entity.VehicleScaleSplitID = model.VehicleScaleSplitID;
            entity.VehicleScaleID = model.VehicleScaleID;
            entity.ProductID = model.ProductID;
            entity.Weight = model.Weight;
            entity.Description = model.Description;
 
            return entity;
        }
        #endregion

        #region Methods Without Relation
        // None process because it has not the children.
        #endregion
    }
}
